package targetToOffer.secDay;

/**
 * @author Godc
 * @description
 */
public class ReverseLeftWords {
}

class ReverseLeftWordsSolution {
    public String reverseLeftWords(String s, int n) {
        StringBuffer buf = new StringBuffer();
        for (int i = n; i < s.length(); i++) {
            buf.append(s.charAt(i));
        }
        for (int i = 0; i < n; i++) {
            buf.append(s.charAt(i));
        }
        return buf.toString();
    }

    /**
     * 利用库函数
     * @param s
     * @param n
     * @return
     */
    public String reverseLeftWords1(String s, int n){
        return s.substring(n,s.length()) + s.substring(0,n);
    }
}